// 继承了我们在最开始实现的抽象类RequstInterceptors，主要关心responseInterceptorsCatch内容
import axios, { type AxiosError } from 'axios'
import type { RequestInterceptors } from '@/api/axios/type'
export const _RequstInterceptors: RequestInterceptors = {
  requestInterceptors(config) {
    // config.headers['Authorization'] ||= AccessToken.value
    return config
  },
  requestInterceptorsCatch(err) {
    return err
  },
  responseInterceptors(res) {
    console.log(res.data)
    return res
  },
  responseInterceptorsCatch(axiosInstance, err: AxiosError) {
    console.log('catch', err)
    if (axios.isCancel(err)) {
      return Promise.reject(err)
    }
    // return retry(axiosInstance, err as AxiosError)
  },
}
